package it.slothy.noveleditor.classes.objects;

import it.slothy.noveleditor.classes.variables.ActStat;
import it.slothy.noveleditor.classes.variables.Friendship;
import it.slothy.noveleditor.enumaration.Gender;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;

public class ProtagonistActor extends Actor {

	//Solo per l'Actor protagonista
	private ArrayList<Friendship> actorFriendships;
	private ArrayList<Item> inventary;
	
	private ExperienceFunction experienceFunction = new ExperienceFunction();
	
	//Variabili che fanno capo solo al protagonista
	private HashMap<String, ActStat> protagonistVariables;
	//Esempio
	//private Integer money, experience, morale, energy, level;
	//private Integer maxMorale, maxEnergy;
	
	public ProtagonistActor(String n, Gender g, File c, int a) {
		super(n, g, c, a);
		
		this.protagonistVariables = new HashMap<String, ActStat>();
	}

	//Friendship
	public void addFriendship(Friendship f){
		this.actorFriendships.add(f);
	}
	
	public void removeFriendship(Friendship f){
		this.actorFriendships.remove(f);
	}
	
	public Friendship getFriendshipOfActor(Actor a){
		for(Friendship f : this.actorFriendships)
			if(f.getDestination().getId() == a.getId())
				return f;
				
		return null;
	}
	
	//Inventario
	public void addItem(Item v){
		this.inventary.add(v);
	}
	
	public void removeItem(Item v){
		this.inventary.remove(v);
	}
	
	public Item getItem(String name){
		for(Item v : this.inventary)
			if(v.getName().equalsIgnoreCase(name))
				return v;
		
		return null;
	}

	public ExperienceFunction getExperienceFunction() {
		return experienceFunction;
	}

	public void setExperienceFunction(ExperienceFunction experienceFunction) {
		this.experienceFunction = experienceFunction;
	}

	public HashMap<String, ActStat> getProtagonistVariables() {
		return protagonistVariables;
	}
	
}
